/*
 *  DriverOption.cpp
 *  powaah
 *
 *  Created by Tim Uusitalo on 4/23/11.
 *  Copyright 2011 __MyCompanyName__. All rights reserved.
 *
 */

#include "DriverOption.h"

using namespace MathUtility;

DriverOption::DriverOption() 
: length(0.0f), angle(0.0f), position(Vector2(0.0f, 0.0f)), potential(0.0f), accelerator(0.0f), brake(0.0f)
{
}

DriverOption::DriverOption(const float length, const float angle)
: position(Vector2(0.0f, 0.0f)), potential(0.0f), accelerator(0.0f), brake(0.0f)
{
	this->length = length;
	this->angle = angle;
	
}

DriverOption::~DriverOption()
{
}

void DriverOption::update(CarState& cs, const float dt)
{
	position = calculatePosition(angle, length);
    this->potential = 0.0f;
}

const float DriverOption::getLength() const
{
	return length;
}

const float DriverOption::getAngle() const
{
	return angle;
}


const Vector2 DriverOption::getPosition() const
{
	return position;
}


const float DriverOption::getPotential() const
{
	return potential;
}

const float DriverOption::getAccelerator() const
{
	return accelerator;
}

const float DriverOption::getBrake() const
{
	return brake;
}


void DriverOption::setLength(const float l)
{
	length = l;
}

void DriverOption::setAngle(const float a)
{
	angle = a;
}

void DriverOption::setPosition(const Vector2& p)
{
	position = p;
}

void DriverOption::setPotential(const float p)
{
	potential = p;
}

void DriverOption::setAccelerator(const float accel)
{
	accelerator = accel; 
}

void DriverOption::setBrake(const float brake)
{
	this->brake = brake;
}


void DriverOption::addPotential(const float p)
{
	potential += p;
}
